import Vue from 'vue'
import VueRouter from 'vue-router'

const Login = () => import('../components/Login.vue')
const Home = () => import('../components/Home.vue')
const Welcome = () => import('../components/Welcome.vue')
const Users = () => import('../components/Users.vue')
const AllTrees = () => import('../components/AllTrees.vue')
const TreeDetail = () => import('../components/TreeDetail.vue')
const TreeEdit = () => import('../components/TreeEdit.vue')
const AllOperationsUnderUser = () =>
    import('../components/AllOperationsUnderUser.vue')
const AllInstance = () => import('../components/AllInstance.vue')
const InstanceDetail = () => import('../components/InstanceDetail.vue')

Vue.use(VueRouter)

const routes = [
    {path: '/', redirect: '/login'},
    {path: '/login', component: Login},
    {
        path: '/home',
        redirect: '/welcome',
        component: Home,
        children: [
            {
                path: '/welcome',
                component: Welcome
            },
            // 所有用户
            {
                path: '/allUsers',
                component: Users
            },
            // 该用户下面的所有（结构）指标树
            {
                path: '/allUnderUser',
                component: AllTrees
            },
            // 该用户下面的所有（实例）指标树
            {
                path: '/allInstance',
                component: AllInstance
            },
            // 算子管理
            {
                path: '/allOperationsUnderUser',
                component: AllOperationsUnderUser
            },
            {
                path: '/treedetial',
                component: TreeDetail
            },
            {
                path: '/instancedetial',
                component: InstanceDetail
            },
            {
                path: '/treeedit',
                component: TreeEdit
            }
        ]
    }
]

const router = new VueRouter({
    routes,
    mode: 'history'
})

export default router
